#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;
float fn(float,float);

int main()
{
    float x0,y0;
    int i;
    float h,m1,m2,m3,m4,xy;
    cout<<"Function:2*y/x\n";
    cout<<"Enter the value of x0 and y0:\n";
    cin>>x0>>y0;
    cout<<"Enter the value of x at which y is to be determined:\n";
    cin>>xy;
    cout<<"Enter the value of h:";
    cin>>h;
    float n=((xy-x0)/h);
    for(i=1;i<=n;i++)
    {
        m1=fn(x0,y0);
        m2=fn(x0+h/2,y0+m1*h/2);
        m3=fn(x0+h/2,y0+m2*h/2);
        m4=fn(x0+h,y0+m3*h);
        x0=x0+h;
        y0=y0+(m1+2*m2+2*m3+m4)*h/6;
    }
    cout<<"y("<<x0<<")="<<y0<<"\n";
    cin.get();
}

float fn(float x,float y)
{
    float z;
    z=2*y/x;
    return(z);
}
